//
//  UIBarButtonItem+quickInit.m
//  classroom
//
//  Created by Macx on 16/7/30.
//  Copyright © 2016年 LiuZhuo. All rights reserved.
//

#import "UIBarButtonItem+quickInit.h"

@implementation UIBarButtonItem (quickInit)
+ (UIBarButtonItem *) itemWithImage:(NSString *)imageName hightLightImage:(NSString *)hightLightImageName target:(id)target action:(SEL)action
{
    
    UIButton * btn = [[UIButton alloc]init];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:hightLightImageName] forState:UIControlStateHighlighted];
    btn.size = btn.currentImage.size;
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem * item = [[UIBarButtonItem alloc ] initWithCustomView:btn];
    return  item;
    ;
    
}
@end
